package demo7;

class Money implements Cloneable{
    public double money = 9.9;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Goods implements Cloneable{
    public String name;
    public Money money;

    public Goods(String name) {
        this.name = name;
        this.money = new Money();
    }


    @Override
    protected Object clone() throws CloneNotSupportedException {
        Goods tmp = (Goods)super.clone();
        tmp.money = (Money)this.money.clone();
        return tmp;
    }

}
